package twi.view.manipulation;

import java.awt.event.MouseEvent;

import prefuse.controls.ControlAdapter;
import prefuse.util.GraphLib;
import prefuse.visual.VisualItem;
import twi_project.TWI;

import com.hp.hpl.jena.ontology.OntResource;

public class SelectionAdapter extends ControlAdapter {

	long last = 0;
	private String lastN = null;
	@Override
	public void itemClicked(VisualItem item, MouseEvent e) {
		String itemName = item.getString(GraphLib.LABEL);
		long curr = System.currentTimeMillis();
		if (curr - last < 200 && lastN != null && lastN.equals(itemName)){
			OntResource or = TWI.getInstance().getOntologieModel().getOntResource(TWI.getInstance().getOntologieModel().getBasePrefix()+itemName);
			System.out.println(or);
			last = 0;
		}
		last = System.currentTimeMillis();
		this.lastN = itemName;
	}

}
